/**
 * Created by ayu on 2017/6/11.
 */
let logger = require ('../utils/logger/Logger');
let sarftCmdmsTaskDao = require ('../daos/SarftCmdmsTaskDao');
let rawDataDao = require ('../daos/RawDataDao');
module.exports = {
    saveTaskInfo: function ( data, callBack )
    {
        let session_code = data;
        sarftCmdmsTaskDao.insertTask (function ( done )
        {
            if (done.isSuccess)
            {
                rawDataDao.updataRawDataPacket_idBySessionCode ([done.id,session_code], function ( done )
                {
                    if(done.isSuccess){
                        callBack({
                            isSuccess:true
                        });
                    }else{
                        logger.error ('场次：' + session_code + ' sarft_cmdms_task 与 sarft_playinfo 关联失败');
                        callBack({
                            isSuccess:false
                        });
                    }
                });
            }
            else
            {
                logger.error ('场次：' + session_code + '插入 sarft_cmdms_task 失败');
                callBack ({
                    isSuccess: false
                });
            }
        });
    }
};